package com.xjy.web.controller.controller;

import java.util.List;
import java.util.Arrays;

import lombok.RequiredArgsConstructor;
import javax.validation.constraints.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import com.xjy.common.annotation.RepeatSubmit;
import com.xjy.common.annotation.Log;
import com.xjy.common.core.controller.BaseController;
import com.xjy.common.core.domain.AjaxResult;
import com.xjy.common.enums.BusinessType;
import com.xjy.system.domain.vo.ReportBudgetIncomeVo;
import com.xjy.system.domain.bo.ReportBudgetIncomeQueryBo;
import com.xjy.system.service.IReportBudgetIncomeService;
import com.xjy.common.utils.poi.ExcelUtil;
import com.xjy.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 预算支出执行报告Controller
 *
 * @author mlb
 * @date 2022-03-08
 */
@Api(value = "预算支出执行报告控制器", tags = {"预算支出执行报告管理"})
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/system/report_budget_income")
public class ReportBudgetIncomeController extends BaseController {

    private final IReportBudgetIncomeService iReportBudgetIncomeService;

    /**
     * 查询预算支出执行报告列表
     */
    @ApiOperation("查询预算支出执行报告列表")
    @PreAuthorize("@ss.hasPermi('system:report_budget_income:list')")
    @GetMapping("/list")
    public TableDataInfo<ReportBudgetIncomeVo> list(@Validated ReportBudgetIncomeQueryBo bo) {
        return iReportBudgetIncomeService.queryPageList(bo);
    }

    /**
     * 导出预算支出执行报告列表
     */
    @ApiOperation("导出预算支出执行报告列表")
    @PreAuthorize("@ss.hasPermi('system:report_budget_income:export')")
    @Log(title = "预算支出执行报告", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult<ReportBudgetIncomeVo> export(@Validated ReportBudgetIncomeQueryBo bo) {
        List<ReportBudgetIncomeVo> list = iReportBudgetIncomeService.queryList(bo);
        ExcelUtil<ReportBudgetIncomeVo> util = new ExcelUtil<ReportBudgetIncomeVo>(ReportBudgetIncomeVo.class);
        return util.exportExcel(list, "预算支出执行报告");
    }

    /**
     * 获取预算支出执行报告详细信息
     */
    @ApiOperation("获取预算支出执行报告详细信息")
    @PreAuthorize("@ss.hasPermi('system:report_budget_income:query')")
    @GetMapping("/{subjectId}")
    public AjaxResult<ReportBudgetIncomeVo> getInfo(@NotNull(message = "主键不能为空")
                                                  @PathVariable("subjectId") Long subjectId) {
        return AjaxResult.success(iReportBudgetIncomeService.queryById(subjectId));
    }


}
